
package ch.hearc.coursJava.kitBase.exerciceTri.hash;

public class Personne implements Comparable<Personne>
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/

	public Personne(String nom, int age)
		{
		this.nom = nom;
		this.age = age;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	@Override
	public String toString()
		{
		StringBuilder builder = new StringBuilder();
		builder.append("Personne [nom=");
		builder.append(this.nom);
		builder.append(", age=");
		builder.append(this.age);
		builder.append("]");
		return builder.toString();
		}

	@Override
	public int compareTo(Personne personne2)
		{
		int memeNom = nom.compareTo(personne2.nom);
		if (memeNom == 0)
			{
			return (new Integer(age)).compareTo(new Integer(personne2.age));
			}
		else
			{
			return memeNom;
			}
		}

	/*------------------------------*\
	|*				Set				*|
	\*------------------------------*/

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	public String getNom()
		{
		return this.nom;
		}

	public int getAge()
		{
		return this.age;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	//Inputs/Outputs
	private String nom;
	private int age;

	}
